//
// NeL - bindings
// Copyright (C) 2010 Naush
//
//This program is free software: you can redistribute it and/or modify
//it under the terms of the GNU Affero General Public License as
//published by the Free Software Foundation, either version 3 of the
//License, or (at your option) any later version.
//
//This program is distributed in the hope that it will be useful,
//but WITHOUT ANY WARRANTY; without even the implied warranty of
//MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//GNU Affero General Public License for more details.
//
//You should have received a copy of the GNU Affero General Public License
//along with this program.  If not, see <http://www.gnu.org/licenses/>.
package org.ryzom.nel.misc;

public class CVector2f {
  private long swigCPtr;
  protected boolean swigCMemOwn;

  public CVector2f(long cPtr, boolean cMemoryOwn) {
    swigCMemOwn = cMemoryOwn;
    swigCPtr = cPtr;
  }

  public static long getCPtr(CVector2f obj) {
    return (obj == null) ? 0 : obj.swigCPtr;
  }

  protected void finalize() {
    delete();
  }

  public synchronized void delete() {
    if (swigCPtr != 0) {
      if (swigCMemOwn) {
        swigCMemOwn = false;
        nelmiscJNI.delete_CVector2f(swigCPtr);
      }
      swigCPtr = 0;
    }
  }

  public void setX(float value) {
    nelmiscJNI.CVector2f_x_set(swigCPtr, this, value);
  }

  public float getX() {
    return nelmiscJNI.CVector2f_x_get(swigCPtr, this);
  }

  public void setY(float value) {
    nelmiscJNI.CVector2f_y_set(swigCPtr, this, value);
  }

  public float getY() {
    return nelmiscJNI.CVector2f_y_get(swigCPtr, this);
  }

  public CVector2f() {
    this(nelmiscJNI.new_CVector2f__SWIG_0(), true);
  }

  public CVector2f(float _x, float _y) {
    this(nelmiscJNI.new_CVector2f__SWIG_1(_x, _y), true);
  }

  public CVector2f(CVector2f v) {
    this(nelmiscJNI.new_CVector2f__SWIG_2(CVector2f.getCPtr(v), v), true);
  }

  public CVector2f(CVector v) {
    this(nelmiscJNI.new_CVector2f__SWIG_3(CVector.getCPtr(v), v), true);
  }

  public CVector asVector() {
    return new CVector(nelmiscJNI.CVector2f_asVector(swigCPtr, this), true);
  }

  public CVector2f addSelf(CVector2f v) {
    return new CVector2f(nelmiscJNI.CVector2f_addSelf(swigCPtr, this, CVector2f.getCPtr(v), v), false);
  }

  public CVector2f subSelf(CVector2f v) {
    return new CVector2f(nelmiscJNI.CVector2f_subSelf(swigCPtr, this, CVector2f.getCPtr(v), v), false);
  }

  public CVector2f mulSelf(float f) {
    return new CVector2f(nelmiscJNI.CVector2f_mulSelf(swigCPtr, this, f), false);
  }

  public CVector2f divSelf(float f) {
    return new CVector2f(nelmiscJNI.CVector2f_divSelf(swigCPtr, this, f), false);
  }

  public CVector2f add(CVector2f v) {
    return new CVector2f(nelmiscJNI.CVector2f_add(swigCPtr, this, CVector2f.getCPtr(v), v), true);
  }

  public CVector2f sub(CVector2f v) {
    return new CVector2f(nelmiscJNI.CVector2f_sub__SWIG_0(swigCPtr, this, CVector2f.getCPtr(v), v), true);
  }

  public CVector2f mul(float f) {
    return new CVector2f(nelmiscJNI.CVector2f_mul__SWIG_0(swigCPtr, this, f), true);
  }

  public CVector2f div(float f) {
    return new CVector2f(nelmiscJNI.CVector2f_div(swigCPtr, this, f), true);
  }

  public CVector2f sub() {
    return new CVector2f(nelmiscJNI.CVector2f_sub__SWIG_1(swigCPtr, this), true);
  }

  public float mul(CVector2f v) {
    return nelmiscJNI.CVector2f_mul__SWIG_1(swigCPtr, this, CVector2f.getCPtr(v), v);
  }

  public float norm() {
    return nelmiscJNI.CVector2f_norm(swigCPtr, this);
  }

  public float sqrnorm() {
    return nelmiscJNI.CVector2f_sqrnorm(swigCPtr, this);
  }

  public void normalize() {
    nelmiscJNI.CVector2f_normalize(swigCPtr, this);
  }

  public CVector2f normed() {
    return new CVector2f(nelmiscJNI.CVector2f_normed(swigCPtr, this), true);
  }

  public void set(float _x, float _y) {
    nelmiscJNI.CVector2f_set(swigCPtr, this, _x, _y);
  }

  public boolean isEqual(CVector2f v) {
    return nelmiscJNI.CVector2f_isEqual(swigCPtr, this, CVector2f.getCPtr(v), v);
  }

  public boolean notEqual(CVector2f v) {
    return nelmiscJNI.CVector2f_notEqual(swigCPtr, this, CVector2f.getCPtr(v), v);
  }

  public boolean isNull() {
    return nelmiscJNI.CVector2f_isNull(swigCPtr, this);
  }

  public void minof(CVector2f a, CVector2f b) {
    nelmiscJNI.CVector2f_minof(swigCPtr, this, CVector2f.getCPtr(a), a, CVector2f.getCPtr(b), b);
  }

  public void maxof(CVector2f a, CVector2f b) {
    nelmiscJNI.CVector2f_maxof(swigCPtr, this, CVector2f.getCPtr(a), a, CVector2f.getCPtr(b), b);
  }

  public void serial(IStream f) {
    nelmiscJNI.CVector2f_serial(swigCPtr, this, IStream.getCPtr(f), f);
  }

  public static CVector2f getNull() {
    long cPtr = nelmiscJNI.CVector2f_Null_get();
    return (cPtr == 0) ? null : new CVector2f(cPtr, false);
  }

}
